{% extends "base.html" %}
{% block body %}
{% import "macros.html" as macros %}

<div id="main" role="main">

		<center>
            <div class="album-title">
                <h5>搜索{% if album.amount %}<small> 结果: {{ album.amount }}  选中: <span id="chk_count">0</span></small>{% endif %}</h5>
                <hr>
                <div class="row">
                    <div class="col-sm-8 col-xs-8">
                        <div class="form-group">
                        <input type="text" class="form-control input-sm" id="keyword_text" value="{{request.args.get('key','')}}">
                        </div>
                    </div>
                    <div class="col-sm-2 col-xs-2">
                        <div class="form-group">
                        <input type="button" class="btn btn-primary btn-sm" value="搜索" id="search_btn">
                        </div>
                    </div>

                </div>
                <div class="search-form">label: pic | album | tag | star | size</div>

                {{ macros.album_tools(album, siteinfo) }}
            </div>
        </center>

        <form id="batch_deal" method="post">
		<ul id="tiles">

			<!-- These are our grid blocks -->
			{% for resp in result %}
			<li>
                <a href="{{resp.url}}">{{resp.img | safe}}</a>
				<div class="post-info">
					<div class="post-basic-info">
                        <p>{{ resp.text | safe}}</p>

                        {% if resp.type == 'pic' %}
                            <p>{{ resp.volumes| safe }}</p>
                            <p>{{ resp.albums | safe}}</p>
                            <p>{{ resp.tags | safe}}</p>
						    <input type="checkbox" class="pics_chk" name="pics_chk" value="{{resp.id}}">
                        {% endif %}
                        <p>{{resp.create_time | safe}}</p>
					</div>
					<div class="post-info-rate">
                        {{ resp.rate | safe }}
                        {{ resp.amount | safe }}
						{{ resp.pv | safe}}
					</div>
					<div class="clear"> </div>
				</div>
			</li>
			{% endfor %}
			<!-- End of grid blocks -->

		</ul>
	</form>
</div>



{% endblock %}


{% block script %}

<!--wookmark-scripts-->
<script src="{{url_for('static',filename='js/jquery.imagesloaded.js')}}"></script>
<script src="{{url_for('static',filename='js/jquery.wookmark.js')}}"></script>

<script type="text/javascript">
// ajax加载更多图片 start
js_more_pics = {
    "page": parseInt("{{page | default(1,true)}}"),
    "url": "{{url_for('api.more')}}",
    "ajax_post_data": {'req': "search",'key':"{{request.args.get('key')}}" },

    }
// ajax加载更多图片 end

js_album = {
    'join_albums_url': "{{url_for('api.batch_join_albums')}}",
}


$('#search_btn').click(function () {
    location.href = "?key=" + $('#keyword_text').val();
})

load_filter("", "{{url_for('api.load_filter', timestamp=siteinfo.cache_refresh_time('album'))}}")
</script>
<!--//wookmark-scripts-->
{% endblock %}